package jianzhi; /**
 * description:
 * author:张腾
 * date:2021-07-07
 */

import niuke.ListNode;

/**
 * 输入两个链表，找出它们的第一个公共节点。
 */
public class jianzhi52 {
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode a = headA,b = headB;
        while (a!=b){
            a = a==null? headB:a.next;
            b = b==null? headA:b.next;
        }
        return a;
    }
}
